package com.whutosa.template.server;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.support.SpringBootServletInitializer;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;

/**
 * Created by 19110 on 2016/9/11.
 */
@SpringBootApplication
@EnableJpaRepositories("com.whutosa.template.server.dao")//Spring Data JPA仓库
public class Booter extends SpringBootServletInitializer {


    /**
     * 使用   jar 打包时使用
     *
     * @param args
     */
    public static void main(String[] args) {
        SpringApplication.run(Booter.class, args);
    }


    /**
     * 使用   war 打包时使用
     * <p>
     * Configure the application. Normally all you would need to do it add sources (e.g.
     * config classes) because other settings have sensible defaults. You might choose
     * (for instance) to add default command line arguments, or set an active Spring
     * profile.
     *
     * @param builder a builder for the application context
     * @return the application builder
     * @see SpringApplicationBuilder
     */
    @Override
    protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) {
        return builder.sources(Booter.class);
    }
}
